package top.kpromise.user.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import top.kpromise.user.model.response.UserPermission;

import java.util.ArrayList;

@Repository
public interface PermissionMapper {

    @Select("select * from user_permission where userId = #{userId} and appId = #{appId}")
    ArrayList<UserPermission> permissionList(String userId, String appId);

    @Insert("insert into user_permission (appId, userId, permission) values (#{appId}, #{userId}, #{permission})")
    int insert(String appId, String userId, String permission);

    @Delete("delete from user_permission where id = #{id} limit 1")
    int delete(int id);
}
